package boke;

import com.common.model.Boke;
import com.jfinal.core.Controller;
import com.jfinal.upload.UploadFile;

import java.util.List;

public class BokeCont extends Controller {


    public void index() {
        setAttr("list", getModel(Boke.class, "").find("select * from boke"));
        render("index.html");

    }

    public void add() {
    }

    public void save() {
        List<UploadFile> flist = getFiles("pic");
        String url = "";
        if (flist.size() != 0) {
            url = "/files/pic/" + flist.get(0).getFileName();
        }
        getModel(Boke.class, "")
                .setPic1(url)
                .save();
        render("add.html");
    }

    public void select() {
        setAttr("bean", getModel(Boke.class).findById(getParaToInt()));
        render("select.html");
    }

    public void select2() {
        System.out.println(getPara());
//        setAttr("bean", getModel(Boke.class).findById(id));
      //  render("select.html");
    }
}
